Xbasic

A5_ADD_FIELDS_TO_TABLE Function

Syntax

L a5_add_fields_to_table(C tablename ,C new_field_list )

Arguments

tablenameCharacter

The name of the table to receive the new field(s). tablename must start with a letter (a-zA-Z) and can contain letters, numbers (0-9), and underscores (_). E.g. "Clients_2_Employees"

new_field_listCharacter

A CR-LF delimited list of one or more field entries. Each entry has the same format as when adding a new field through the Restructure Table dialog box. The format for each field entry is as follows (Width and Decimals are optional): Field_Name as C, Field_Type as C [, Width as N [, Decimals as N ]]

The Field_Type can be one of the following values:

Field_Type
Description
"activex"

ActiveX

"bitmap"

Windows Bitmap image field

"C"

character

"D"

date

"E"

exponent

"image"

image file reference

"jpeg"

JPEG image field

"L"

logical

"N"

numeric

"M"

memo

"ole"

OLE

"R"

RTF memo

"T"

time

"Y"

short time

Returns

ResultLogical

Returns .t. if the operation succeeds, otherwise .f.

Description

Adds fields to a table. New_fields is a crlf list of fields to be added in format: fieldname,type,size,decimals

Discussion

The A5_ADD_FIELDS_TO_TABLE() function adds field(s) to an existing table.

Example

dim tbl as P
tbl = table.open("product")
? tbl.fields_get()
= 7.000000
a5_add_fields_to_table("product", "junk,C,0")
tbl = table.open("product")
? tbl.fields_get()
= 8.000000
tbl.close()

Limitations

Desktop applications only

See Also